﻿import flash.geom.Point;
import flash.geom.Matrix;
import com.embedchat.skins.standart.window.WindowClass;

class com.embedchat.skins.standart.window.TypeWindowClass extends WindowClass{
	static var instanceName:String = new String ("TypeWindowClass");
	static var instanceOwner:Object = com.embedchat.skins.standart.window.TypeWindowClass;

	[Inspectable(name="Window width",defaultValue=200,type:Number)]
	public var canvasWidth:Number;
	[Inspectable(name="Window height",defaultValue=100,type:Number)]	
	public var canvasHeight:Number;
	[Inspectable(name="Target Log Window ",defaultValue=null,type:String)]	
	public var targetViewWindowPath:String;	
	
	private var targetViewWindow:MovieClip;	
	//constructor
	function TypeWindowClass(){
		super();
		this.targetViewWindow = (this.targetViewWindowPath != "")?eval(this.targetViewWindowPath):null;
			
		this.setTextFieldType("input");
		this.textField.onChanged = this.onTextChanged;
	}
	public function onTextChanged(sender:TextField):Void{
		var targetWindow:MovieClip = _parent.targetViewWindow;
//		var str:String = this.text;
		//addTextFieldText
		switch (Key.getCode()) {
  		  case Key.ENTER :
		 	if (Key.isDown(Key.SHIFT)) {
		  		_parent.targetViewWindow.addTextFieldText(sender.text);
				_parent.targetViewWindow.scrollDown();
				sender.text = "";
			}
		  break;
		}
//		trace(_parent.targetViewWindow);
	}
	//
}